package com.slz3.business.module.goodsManagement.gooGoods.steward;

import com.slz3.business.module.goodsManagement.gooGoods.domain.GooGoods;
import com.slz3.business.module.goodsManagement.gooGoods.domain.GooGoodsCondition;
import org.springframework.stereotype.Component;
import org.springframework.web.reactive.function.server.ServerRequest;
import org.springframework.web.reactive.function.server.ServerResponse;
import reactor.core.publisher.Mono;

import javax.annotation.Resource;
@Component
public class GooGoodsResponse {

    @Resource
    private GooGoodsResController gooGoodsResController;

    public Mono<ServerResponse> add(ServerRequest req) {
        return req.bodyToMono(GooGoods.class).flatMap(gooGoods ->
                gooGoodsResController.add(req, gooGoods)
        );
    }

    public Mono<ServerResponse> delete(ServerRequest req) {
        return req.bodyToMono(GooGoodsCondition.class).flatMap(gooGoodsCondition ->
                gooGoodsResController.delete(req, gooGoodsCondition)
        );
    }

    public Mono<ServerResponse> modify(ServerRequest req) {
        return req.bodyToMono(GooGoods.class).flatMap(gooGoods ->
                gooGoodsResController.modify(req, gooGoods)
        );
    }


    public Mono<ServerResponse> list(ServerRequest req) {
        return gooGoodsResController.list(req);
    }

    public Mono<ServerResponse> info(ServerRequest req) {
        return gooGoodsResController.info(req);
    }

    public Mono<ServerResponse> choice(ServerRequest req) {
        return gooGoodsResController.choice(req);
    }

    public Mono<ServerResponse> auditSubmit(ServerRequest req) {
        return req.bodyToMono(GooGoodsCondition.class).flatMap(gooGoodsCondition ->
                gooGoodsResController.auditSubmit(req, gooGoodsCondition)
        );
    }

    public Mono<ServerResponse> audit(ServerRequest req) {
        return req.bodyToMono(GooGoodsCondition.class).flatMap(gooGoodsCondition ->
                gooGoodsResController.audit(req, gooGoodsCondition)
        );
    }

    public Mono<ServerResponse> auditReject(ServerRequest req) {
        return req.bodyToMono(GooGoodsCondition.class).flatMap(gooGoodsCondition ->
                gooGoodsResController.auditReject(req, gooGoodsCondition)
        );
    }

    public Mono<ServerResponse> usingEnable(ServerRequest req) {
        return req.bodyToMono(GooGoodsCondition.class).flatMap(gooGoodsCondition ->
                gooGoodsResController.usingEnable(req, gooGoodsCondition)
        );
    }

    public Mono<ServerResponse> usingDisable(ServerRequest req) {
        return req.bodyToMono(GooGoodsCondition.class).flatMap(gooGoodsCondition ->
                gooGoodsResController.usingDisable(req, gooGoodsCondition)
        );
    }

}
